﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace CATSearchTool.BLL
{
    // 验证External_ID
    public class DataValidation : ValidationRule
    {
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            
            if (value != null)
            {
                if (Regex.IsMatch(value.ToString(), "^[a-z]{3}-\\d{8}-\\d{8}$"))
                {
                    return new ValidationResult(true, null);
                }
                else
                {
                    return new ValidationResult(false, "当前输入无效");
                }
            }
            else
            {
                return new ValidationResult(true, null);
            }
        }
    }
}
